﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Feedback.aspx.cs" Inherits="UI_Bas_Feedback" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>ebay评论管理</title>   
    <link href="../../css/admin.css" rel="stylesheet" type="text/css" />
    <link href="../../js/jquery.easyui/themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <link href="../../js/jquery.easyui/themes/icon.css" rel="stylesheet" type="text/css" />
    <script src="../../js/jquery.easyui/jquery.min.js" type="text/javascript"></script>
    <script src="../../js/jquery.easyui/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../../js/jquery.easyui/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
  
    <script type ="text/javascript" >
        $(function () {
            $("#ddlebayUserId").combobox({
                editable: false
            });

            $("#ddlCommentType").combobox({
                editable: false
            });

            var defaultDate = Date.parse('1900/01/01');
            var _$ebayfeedback = $("#ebayfeedback");
            _$ebayfeedback.datagrid({
                border: true,
                height: 750,
                title: '评论列表...',
                remoteSort: false,
                nowrap: true,
                striped: false,
                url: "../../TableHanders.aspx?act=q&tid=11&type=0",
                pageSize: 30,
                sortName: 'FeedBackID',
                sortOrder: 'desc',
                loadMsg: "正在加载,请稍后...",

                frozenColumns: [[
	                { title: 'EbayUserId', field: 'EbayUserId', width: 85, sortable: true, formatter: function (val, rec) {
	                    if (rec.CommentType == "Positive") {
	                        return '<span style="color:green;">' + val + '</span>';
	                    }
	                    else if (rec.CommentType == "Neutral") {
	                        return '<span style="color:gray;">' + val + '</span>';
	                    }
	                    else if (rec.CommentType == "Negative") {
	                        return '<span style="color:red;">' + val + '</span>';
	                    }
	                    else {
	                        return val;
	                    }
	                }
	                },
	                { title: 'FeedbackID', field: 'FeedbackID', width: 100, sortable: true, formatter: function (val, rec) {
	                    if (rec.CommentType == "Positive") {
	                        return '<span style="color:green;">' + val + '</span>';
	                    }
	                    else if (rec.CommentType == "Neutral") {
	                        return '<span style="color:gray;">' + val + '</span>';
	                    }
	                    else if (rec.CommentType == "Negative") {
	                        return '<span style="color:red;">' + val + '</span>';
	                    }
	                    else {
	                        return val;
	                    }
	                }
	                }
				  ]],
                columns: [[
	                { title: 'OrderLineItemID', field: 'OrderLineItemID', width: 200, sortable: true },
                    { title: 'ItemID', field: 'ItemID', width: 100, sortable: true },
	                { title: 'ItemTitle', field: 'ItemTitle', width: 500, sortable: true },
	                { title: 'ItemPrice', field: 'ItemPrice', width: 60, sortable: true, align: 'right' },
	                { title: 'User', field: 'CommentingUser', width: 85, sortable: true },
	                { title: 'UserScore', field: 'CommentingUserScore', width: 60, sortable: true, align: 'right' },
	                { title: 'Text', field: 'CommentText', width: 500, sortable: true },
	                { field: 'CommentTime', title: 'CommentTime', width: 120, sortable: true, formatter: function (val) {
	                    var d = Date.parse(val.replace("-", "/"));
	                    if (d == defaultDate) {
	                        return "";
	                    }
	                    else {
	                        return val;
	                    }
	                }
	                },
	                { title: 'CommentType', field: 'CommentType', width: 80, sortable: true, formatter: function (val, rec) {
	                    if (val == "Positive") {
	                        return '<span style="color:green;">' + val + '</span>';
	                    }
	                    else if (val == "Neutral") {
	                        return '<span style="color:gray;">' + val + '</span>';
	                    }
	                    else if (val == "Negative") {
	                        return '<span style="color:red;">' + val + '</span>';
	                    }
	                    else {
	                        return val;
	                    }
	                }
	                },
	                { title: 'Role', field: 'Role', width: 80, sortable: true },
	                { title: 'EbayTransactionID', field: 'TransactionID', width: 150, sortable: true }
				  ]],
                pagination: true,
                rownumbers: true,
                singleSelect: true,
                pageList: [10, 15, 30,50,100],
                onDblClickRow: function (rowIndex, rowData) {
                    var id = rowData.FeedbackID;
                    var id2 = rowData.EbayUserId;
                    var ret = window.showModalDialog("FeedbackDetail.aspx?act=view&id=" + id + "&id2=" + id2 + "&ts=" + new Date().getTime(), "", "dialogHeight:520px;dialogWidth:580px;edge:Raised;center:Yes;help:No;resizable:no;status:no; scroll:no;location=no;");
                    if (ret) {
                        $("#ebayfeedback").datagrid('reload');
                    }
                },
                queryParams: {
                    "timeFrom": $("#dateFrom").datebox('getValue'),
                    "timeTo": $("#dateTo").datebox('getValue'),
                    "ebayUserId": $("#ddlebayUserId").combobox('getValue'),
                    "OrderLineItemId": $("#txtOrderLineItemId").val(),
                    "CommentType": $("#ddlCommentType").combobox('getValue'),
                    "User": $("#txtUser").val(),
                    "ItemID": $("#txtItemID").val()
                }
            });
            $("#btnQuery").click(function () {
                if (!$("#divContent").form('validate'))
                    return;
                var timeFrom = $("#dateFrom").datebox('getValue');
                var timeTo = $("#dateTo").datebox('getValue');
                var ebayUserId = $("#ddlebayUserId").combobox('getValue');
                var commentType = $("#ddlCommentType").combobox('getValue');
                _$ebayfeedback.datagrid({
                    queryParams: {
                        "timeFrom": timeFrom,
                        "timeTo": timeTo,
                        "ebayUserId": ebayUserId,
                        "OrderLineItemId": $("#txtOrderLineItemId").val(),
                        "CommentType": commentType,
                        "User": $("#txtUser").val(),
                        "ItemID": $("#txtItemID").val()
                    }
                });
            });
            $('#dateFrom').datebox({ formatter: function (date) {
                var y = date.getFullYear();
                var m = date.getMonth() + 1;
                var d = date.getDate();
                return y + "-" + m + "-" + d;
            }
            });
            $('#dateTo').datebox({ formatter: function (date) {
                var y = date.getFullYear();
                var m = date.getMonth() + 1;
                var d = date.getDate();
                return y + "-" + m + "-" + d;
            }
            });
        });
	</script>	
</head>
<body>
  <div class="div_Title">
    <span class="Body_Title">》》<%=this.Title %></span>
   </div>    
 <div id= "divContent" class ="easyui-panel" title ="请输入查询条件..." style="margin-bottom:5px;">  
    <form id="formQuery" runat="server">      
       <table>
             <tr>         
                <td>OrderLineItemId:</td>    
                <td>
                     <input ID="txtOrderLineItemId" runat="server" style="width:213px;"/>
                </td>                 
                <td>帐号:</td>    
                <td>                         
                    <select ID="ddlebayUserId" runat="server" style="width:150px"></select>
                </td>
                <td>Comment Type:</td>
                <td>
                    <select id="ddlCommentType" runat="server" style="width:150px"></select>
                </td>               
                <td>评论日期:</td>
                <td>                       
                    <input type ="text" ID ="dateFrom" runat="server" class ="easyui-datebox" required="true" style ="width :90px"  />                                                     
                  </td>
                <td> - </td>
                <td>
                   <input type ="text" ID="dateTo"  runat="server" class ="easyui-datebox" required="true" style ="width :90px" />       
                  </td>                                                         
                 <td>
                     <a id="btnQuery"  href ="#"  class="easyui-linkbutton" icon="icon-search" >Query</a>    
                  </td>
             </tr>      
             <tr>
              <td>User:</td>    
                <td>
                     <input ID="txtUser" runat="server" style="width:150px;"/>
                </td> 
                <td>ItemID:</td>    
                <td>
                     <input ID="txtItemID" runat="server" style="width:150px;"/>
                </td>  
             </tr>          
        </table>
        </form>  
       </div>     
    <div id="divData">
        <table id="ebayfeedback" ></table>
    </div>    
</body>
</html>
